#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    int f[200010] = {0};
    int FindGreatestSumOfSubArray(vector<int> array)
    {
        f[0] = array[0];
        int ret = array[0];
        for (int i = 1; i < array.size(); ++i)
        {
            if (f[i - 1] > 0)
            {
                f[i] = array[i] + f[i - 1];
            }
            else
            {
                f[i] = array[i];
            }
            ret = max(ret, f[i]);
        }
        return ret;
    }
};